package chain.example.delivery.chain;


import chain.example.delivery.DeliveryState;
import chain.example.delivery.decorate.NoneInfo;
import chain.example.delivery.decorate.PayedInfo;
import chain.example.delivery.decorate.StateInfo;

public class PayedChain implements Delivery {
    @Override
    public StateInfo doDelivery(int state, DeliveryChain deliveryChain) {
        if (state == DeliveryState.PAYED.getState()) {
                return new PayedInfo(new NoneInfo());
        }

        StateInfo stateInfo = deliveryChain.doChain(state);
        return  new PayedInfo(stateInfo);
    }

}
